package main

import (
	"fmt"
	"html/template"
	"os"
)

func main() {
	const s = `"Fran & Freddie's Diner" <tasty@example.com>`
	v := []interface{}{`"Fran & Freddie's Diner"`, ' ', `<tasty@example.com>`}

	fmt.Println(template.HTMLEscapeString(s))
	template.HTMLEscape(os.Stdout, []byte(s))
	fmt.Fprintln(os.Stdout, "")
	fmt.Println(template.HTMLEscaper(v...))

	fmt.Println(template.JSEscapeString(s))
	template.JSEscape(os.Stdout, []byte(s))
	fmt.Fprintln(os.Stdout, "")
	fmt.Println(template.JSEscaper(v...))

	fmt.Println(template.URLQueryEscaper(v...))
	//&#34;Fran &amp; Freddie&#39;s Diner&#34; &lt;tasty@example.com&gt;
	//&#34;Fran &amp; Freddie&#39;s Diner&#34; &lt;tasty@example.com&gt;
	//&#34;Fran &amp; Freddie&#39;s Diner&#34;32&lt;tasty@example.com&gt;
	//\"Fran \u0026 Freddie\'s Diner\" \u003Ctasty@example.com\u003E
	//\"Fran \u0026 Freddie\'s Diner\" \u003Ctasty@example.com\u003E
	//\"Fran \u0026 Freddie\'s Diner\"32\u003Ctasty@example.com\u003E
	//%22Fran+%26+Freddie%27s+Diner%2232%3Ctasty%40example.com%3E
}
